// import axios from 'axios'
import { request } from '@/utils/request'

// 密码登录
export const loginByPassword = (account, password) =>
  request('users/loginByPassword', 'POST', { account, password })

//密码登录
// export const loginByPassword = async (account, password, token) => {
//   try {
//     const response = await axios.post(
//       'http://localhost:8888/users/loginByPassword',
//       { account, password },
//       {
//         headers: {
//           Authorization: `Bearer ${token}`
//         }
//       }
//     )
//     return response
//   } catch (error) {
//     return error
//   }
// }
//验证码登录
export const loginByCode = (account, code) =>
  request('users/loginByCode', 'POST', { account, code })

//发送验证码
export const getIdentCode = (account) => request('users/getIdentCode', 'POST', { account })

//获取头像图片
export const getImage = (pic) => request('images', 'POST', { pic })

//编辑用户信息
export const editUserInfo = (formData) => request('users/editUserInfo', 'POST', formData)

//查询用户所有信息
export const getUserInfo = (account) => request('users/getUserInfo', 'GET', { account })

//验证手机号码验证码
export const verifyAccount = (account, code) =>
  request('/users/verifyAccount', 'POST', { account, code })

//修改手机号码接口
export const updateAccount = (newAccount, oldAccount) =>
  request('/users/updateAccount', 'PUT', { newAccount, oldAccount })

//修改密码
export const updatePassword = (formData) => request('/users/updatePassword', 'POST', formData)
